<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-CN" />
<meta name="copyright" content="闻康集团刘代明监制" />
<meta name="robots" content="all" />
{$css_file}
{$js_file}
{$js_dialog}
<style type="text/css">
.regItem label.error {
	padding-left: 20px;
	background: url(__PUBLIC__/Images/admin/onError.gif) no-repeat;
}

.regItem label.correct {
	padding-left: 20px;
	background: url(__PUBLIC__/Images/admin/onCorrect.gif) no-repeat;
}
</style>
<script type="text/javascript">
function addMaterial(type,obj){
	if (type == 1) {
        var title = '添加主料';
	} else {
	    var title = '添加辅料';
	}
    var html = '<div class="estransfer"><ul>';
    html += '<li id="error" style="color:red;margin-bottom:20px; text-align:center;"></li>';
    html += '<li><span>'+title+'：</span><textarea id="material" name="material" cols="80" rows="10">'+ $(obj).next('input').val() +'</textarea></li>';
    html += '</ul></div>';
	 $.dialog({
         title:title,
		 fixed:true,
	     resize: false,
	     ok:true,
	     cancelVal: '取消',
	     cancel: true,
	     content:html,
	     ok:function(){
		     $(obj).next('input').val($("#material").val().replace(/[\r\n]/g," "));
	     }
	 });
}
//字段非空验证
function validate(form) {
    if (form.recipename.value == "") {
         alert("请填写食谱名称！");
         form.recipename.focus();
         return false;
     }
    return true;
}
</script>
</head>
<body>
	<div class="main">
		<div class="crumbs">
			当前位置：<span id="current_pos">面板->疾病饮食管理->编辑食谱</span>
		</div>
		<div class="m_content" id="right_main">
			<div class="content_menu blue line-x">
				<a class="on" href="__GROUP__/Disassistant/disFood"><em>疾病食谱列表</em></a>
			</div>
			<form action="__GROUP__/Disassistant/editDisFood" method="post" enctype="multipart/form-data" onsubmit="return validate(this);">
				<div class="tableform" id="tab_1">
					<h5>编辑食谱</h5>
					<div class="division">
						<table cellspacing="0" cellpadding="0" border="0"
							class="shop_config">
							<tbody>
								<tr class="regItem">
									<th>食谱名称：</th>
									<td><input type="text" class="text" name="recipename" value="{$list.recipename}" /></td>
								</tr>
								<tr class="regItem">
									<th>食谱图片：</th>
									<td><input type="file" class="text" name="imgaddress" value="{$list.imgaddress}" /></td>
								</tr>
								<tr class="regItem">
									<th>食谱贴士：</th>
									<td><textarea class="text" name="diettips">{$list.diettips}</textarea></td>
								</tr>
								<tr class="regItem">
									<th>类别：</th>
									<td>
									   <select name="type">
									       <volist name='type' id='vo'>
									           <eq name='list.type' value='$i'>
									               <option value="{$i}" selected='selected'>{$vo}</option>
									           <else/>
									               <option value="{$i}">{$vo}</option>
									           </eq>
									       </volist>
									   </select>
									</td>
								</tr>
								<tr class="regItem">
									<th>营养：</th>
									<td>
									   <select name="nutrition">
									       <volist name='nutrition' id='vo'>
									           <eq name='list.nutrition' value='$i'>
									               <option value="{$i}" selected='selected'>{$vo}</option>
									           <else/>
									               <option value="{$i}">{$vo}</option>
								               </eq>
									       </volist>
									   </select>
									</td>
								</tr>
								<tr class="regItem">
									<th>主料：</th>
									<td>
									   <a style='color:blue' href="javascript:void(0);" onclick="addMaterial(1,this);">添加</a>
									   <input style='border:none;background:none;' readonly type='text' name='mainingredient' value="{$list.mainingredient}" />
								    </td>
								</tr>
								<tr class="regItem">
									<th>辅料：</th>
									<td>
									   <a style='color:blue' href="javascript:void(0);" onclick="addMaterial(2,this);">添加</a>
									   <input style='border:none;background:none;' readonly type='text' name='accessories' value="{$list.accessories}" />
									   <input type='hidden' name='id' value='{$list.id}' />
								    </td>
								</tr>
								<tr class="regItem">
									<th>食谱详情：</th>
									<td><textarea cols='80' rows='10' class="text" name="recipesdetails">{$list.recipesdetails}</textarea></td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
				<div style="text-align: center;">
					<input type="submit" class="button" value="确定 " name="submit" /> 
					<input type="reset" class="button" value="重置 " name="reset" />
				</div>
			</form>
		</div>
	</div>
</body>

</html>